home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Apps / ArchiveUtils / tar / next / patch_info < prev    next >
Encoding:
Text File  |  1992-12-20  |  2.8 KB  |  76 lines

  1. In an earlier posting, I noted that GNU tar 1.10 will core dump
  2. if long filenames (length greater than NAMSIZ) are encountered in 
  3. multi-volume mode. In this posting the error is described and a patch given.
  4.  
  5. The essence of the problem is that the pointer save_name, which is set 
  6. in function dump_file() of module create.c, points to the original 
  7. long filename instead of the new, shorter mangled name that is set in 
  8. start_header() of module create.c. The pointer save_name is only used 
  9. in multi-volume mode when the file being processed is non-sparse; if a 
  10. file is split between volumes, the save_name is used in generating 
  11. the LF_MULTIVOL record on the second volume. In the original code, the 
  12. core dump was due to strcpy() writing a string longer than NAMSIZ 
  13. to string real_s_name in fl_write() of module buffer.c; this error 
  14. will not happen with the patch to create.c since the mangled names 
  15. are shorter than NAMSIZ.
  16.  
  17. Only the patch to create.c is really necessary. The patch to buffer.c 
  18. was what I first put in to stop tar from core dumping. I have tested 
  19. this code with long filenames where the file in question is split 
  20. between volumes. The files are recovered and renamed properly. 
  21. I have *not* tested the code to see if the patch for long directory 
  22. names works properly.
  23.  
  24. -pierce
  25. --
  26. Pierce Cantrell              cantrell@ee.tamu.edu
  27. Dept. of Elec. Eng.
  28. Texas A&M University
  29.  
  30.  
  31.  
  32. cantrell# diff create.c.orig create.c
  33. 158a159,163
  34. > /* handle multivolume mangled properly PEC 7-29-91 */
  35. > static int mange;
  36. > char mange_name[NAMSIZ];
  37. > /* end PEC 7-29-91*/
  38. 531c536,541
  39. <                               save_name = p;
  40. ---
  41. >                               /* PEC 7-29-91 */
  42. >                               if(mange)
  43. >                                 save_name = mange_name;
  44. >                               else
  45. >                                 save_name = p;
  46. >                               /* end PEC 7-29-91 */
  47. 689c699,704
  48. <                                       save_name=p;
  49. ---
  50. >                                       /* PEC 7-29-91 */
  51. >                                       if(mange)
  52. >                                         save_name = mange_name;
  53. >                                       else
  54. >                                         save_name=p;
  55. >                                       /* end PEC 7-29-91 */
  56. 1160a1176,1178
  57. >       /* PEC 7-29-91 */
  58. >       mange = 0;
  59. >       /* end PEC 7-29-91 */
  60. 1166a1185,1188
  61. >               /* PEC 7-29-91 */
  62. >               mange = 1;
  63. >               strncpy(mange_name, header->header.name, NAMSIZ);
  64. >               /* end PEC 7-29-91 */
  65.  
  66.  
  67. cantrell# diff buffer.c.orig buffer.c
  68. 693c693,695
  69. <                       strcpy(real_s_name,save_name);
  70. ---
  71. > /*                    strcpy(real_s_name,save_name); */
  72. >                       strncpy(real_s_name,save_name,NAMSIZ-1);
  73. >                       real_s_name[NAMSIZ]='\0';
  74.  
  75.